Skip to content
This repository was archived by the owner on Nov 23, 2025. It is now read-only.

Dev#6

Merged
RandithaK merged 43 commits intomainfrom
dev
Nov 8, 2025
Merged

Dev#6
RandithaK merged 43 commits intomainfrom
dev

Conversation

@RandithaK
Copy link
Copy Markdown
Member

@RandithaK RandithaK commented Nov 8, 2025

Summary by CodeRabbit

  • New Features

    • Complete REST API for time log management with create, retrieve, update, and delete operations
    • Summary and analytics endpoints with period-based aggregation and statistics
    • Project and service-based filtering capabilities
    • Role-based access control with employee ownership validation
    • OpenAPI (Swagger) documentation and interactive API explorer
  • Documentation

    • Comprehensive setup guides, quick-start instructions, and troubleshooting documentation
    • Database setup and runtime verification procedures
    • API endpoint reference with example requests
  • Infrastructure

    • Docker containerization for service deployment
    • GitHub Actions CI/CD pipelines for building, testing, and deploying to Kubernetes
    • Database seeding for development environment
  • Tests

    • Test infrastructure with batch scripts and PowerShell smoke tests for endpoint validation
    • H2 in-memory database configuration for integration testing

Dhanuja416 and others added 30 commits November 2, 2025 09:42
Copilot AI review requested due to automatic review settings November 8, 2025 11:13
@gitguardian
Copy link
Copy Markdown

gitguardian bot commented Nov 8, 2025

⚠️ GitGuardian has uncovered 12 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
22222409 Triggered PostgreSQL Credentials d306e7c DATABASE_SETUP_GUIDE.md View secret
22222408 Triggered PostgreSQL Credentials d306e7c DATABASE_CONNECTION_SUMMARY.md View secret
22222407 Triggered PostgreSQL Credentials d306e7c DATABASE_CONNECTION_SUMMARY.md View secret
22222408 Triggered PostgreSQL Credentials d306e7c DATABASE_CONNECTION_SUMMARY.md View secret
22222408 Triggered PostgreSQL Credentials d306e7c DATABASE_CONNECTION_SUMMARY.md View secret
22222408 Triggered PostgreSQL Credentials d306e7c DATABASE_CONNECTION_SUMMARY.md View secret
22222408 Triggered PostgreSQL Credentials d306e7c DATABASE_CONNECTION_SUMMARY.md View secret
22222406 Triggered PostgreSQL Credentials d306e7c DATABASE_SETUP_GUIDE.md View secret
22222407 Triggered PostgreSQL Credentials d306e7c DATABASE_CONNECTION_SUMMARY.md View secret
22222409 Triggered PostgreSQL Credentials d306e7c DATABASE_SETUP_GUIDE.md View secret
22222408 Triggered PostgreSQL Credentials d306e7c DATABASE_CONNECTION_SUMMARY.md View secret
22222406 Triggered PostgreSQL Credentials d306e7c DATABASE_SETUP_GUIDE.md View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Nov 8, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Comprehensive implementation of a Time Logging Service with REST endpoints, database integration, Docker containerization, and Kubernetes deployment pipelines. Includes data seeding, RBAC security, global exception handling, OpenAPI documentation, and extensive operational guidance.

Changes

Cohort / File(s) Summary
CI/CD & Deployment Pipelines
.github/workflows/build.yaml, .github/workflows/deploy.yaml
Added GitHub Actions workflows: build.yaml orchestrates Maven build/test and Docker image push to GHCR on main/devOps/dev; deploy.yaml triggers on build completion, pulls external k8s-config repo, updates deployment manifests with new image SHA, and applies rollout.
Containerization
Dockerfile, time-logging-service/pom.xml
Added multi-stage Dockerfile (Maven build → minimal JRE runtime on port 8085); added H2 test-scoped dependency to pom.xml.
Security & Configuration
time-logging-service/src/main/java/.../config/SecurityConfig.java, time-logging-service/src/main/java/.../config/OpenApiConfig.java, time-logging-service/src/main/java/.../config/GatewayHeaderFilter.java, time-logging-service/src/main/java/.../config/SharedConstants.java
Updated SecurityConfig with toggleable security, public endpoint whitelist, and custom access-denied handler; added OpenApiConfig for Swagger/JWT setup; updated GatewayHeaderFilter to map SUPER\_ADMIN to dual roles; introduced SharedConstants for cross-service ID alignment (users, services, projects, work types, roles).
Database & Data Seeding
time-logging-service/src/main/java/.../config/DatabasePreflightInitializer.java, time-logging-service/src/main/java/.../config/DataSeeder.java, time-logging-service/src/main/java/.../repository/TimeLogRepository.java
Updated DatabasePreflightInitializer package path; added DataSeeder component that seeds sample time logs in dev profile on startup; expanded TimeLogRepository with methods for filtering by employee/project/date-range and computing total hours.
Entity & DTOs
time-logging-service/src/main/java/.../entity/TimeLog.java, time-logging-service/src/main/java/.../dto/request/TimeLogRequest.java, time-logging-service/src/main/java/.../dto/request/TimeLogUpdateRequest.java, time-logging-service/src/main/java/.../dto/response/TimeLogResponse.java, time-logging-service/src/main/java/.../dto/response/TimeLogSummaryResponse.java, time-logging-service/src/main/java/.../dto/mapper/TimeLogMapper.java
Added projectId field to TimeLog; added explicit getters/setters for all TimeLog fields; created request/response DTOs with validation; added TimeLogMapper for entity↔DTO conversions.
Service Layer
time-logging-service/src/main/java/.../service/TimeLoggingService.java, time-logging-service/src/main/java/.../service/impl/TimeLoggingServiceImpl.java, time-logging-service/src/main/java/.../service/TimeLogService.java
Updated TimeLoggingService interface signatures (request/response types); implemented TimeLoggingServiceImpl with CRUD, authorization checks, and summary logic; added comprehensive TimeLogService with date-range queries, authorization, aggregations, and statistics.
REST Controller
time-logging-service/src/main/java/.../controller/TimeLogController.java, time-logging-service/src/main/java/.../controller/TimeLoggingController.java
Added new TimeLogController with 9 endpoints (CRUD, date-range, service/project/employee filters, summary, stats) with @PreAuthorize RBAC; deleted old TimeLoggingController placeholder.
Exception Handling
time-logging-service/src/main/java/.../exception/GlobalExceptionHandler.java, time-logging-service/src/main/java/.../exception/ResourceNotFoundException.java, time-logging-service/src/main/java/.../exception/UnauthorizedAccessException.java, time-logging-service/src/main/java/.../error/RestExceptionHandler.java
Added GlobalExceptionHandler for centralized exception mapping (404/403/400/500 with structured JSON responses); added custom exceptions (ResourceNotFoundException, UnauthorizedAccessException); added RestExceptionHandler (legacy/parallel handler).
Events
time-logging-service/src/main/java/.../events/TimeLogEventPublisher.java, time-logging-service/src/main/java/.../events/NoopTimeLogEventPublisher.java
Added TimeLogEventPublisher interface and NoopTimeLogEventPublisher no-op implementation for future event publishing.
Application Configuration
time-logging-service/src/main/resources/application.properties, time-logging-service/src/main/resources/META-INF/spring.factories, time-logging-service/src/test/resources/application-test.properties
Added app.security.enabled toggle; updated spring.factories package path; added test profile with H2 in-memory database configuration.
Test Infrastructure
time-logging-service/src/test/java/.../TimeLoggingServiceApplicationTests.java
Activated test profile via @ActiveProfiles("test").
Documentation (Root)
README.md, DATABASE_CONNECTION_SUMMARY.md, DATABASE_AND_RUNTIME_STATUS.md, DATABASE_SETUP_GUIDE.md, IMPLEMENTATION_SUMMARY.md, PROGRESS_REPORT.md, QUICK_START.md, SUBMISSION_CHECKLIST.md
Comprehensive documentation: README covers full service overview with status/architecture/endpoints; DATABASE_*.md files detail setup/seeding/verification; IMPLEMENTATION_SUMMARY.md codifies feature completeness; PROGRESS_REPORT.md tracks 95% completion; QUICK_START.md and SUBMISSION_CHECKLIST.md provide operational guidance.
Service Documentation & Scripts
time-logging-service/README.md, time-logging-service/HOW_TO_RUN.md, time-logging-service/QUICK_START.md, time-logging-service/BUILDER_ISSUE_FIXED.md, time-logging-service/ALL_ISSUES_RESOLVED.md, time-logging-service/FIX_SUMMARY.md, time-logging-service/GETTERS_FIXED.md, time-logging-service/PORT_CONFLICT_SOLUTION.md, time-logging-service/final-test.bat, time-logging-service/test-build.bat, time-logging-service/scripts/smoke_test.bat, time-logging-service/test-endpoints.ps1
Service-specific documentation (setup, run, troubleshooting, fix chronicles); added Windows batch and PowerShell test scripts for build verification and endpoint smoke testing.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant SecurityFilter
    participant TimeLogController
    participant TimeLogService
    participant Repository
    participant Database

    Client->>SecurityFilter: HTTP Request + JWT
    SecurityFilter->>SecurityFilter: Validate token & extract roles
    SecurityFilter->>TimeLogController: Route to handler
    TimeLogController->>TimeLogController: `@PreAuthorize` check (RBAC)
    TimeLogController->>TimeLogService: createTimeLog(employeeId, request)
    TimeLogService->>TimeLogService: Map DTO → Entity
    TimeLogService->>Repository: save(timeLog)
    Repository->>Database: INSERT
    Database-->>Repository: Row inserted
    Repository-->>TimeLogService: Saved entity
    TimeLogService->>TimeLogService: Map Entity → Response DTO
    TimeLogService-->>TimeLogController: TimeLogResponse
    TimeLogController-->>Client: 201 Created + JSON body

    Client->>TimeLogController: GET /time-logs/{id}?userId=X&userRole=EMPLOYEE
    TimeLogController->>TimeLogService: getTimeLogByIdWithAuthorization(id, userId, role)
    TimeLogService->>Repository: findByIdAndEmployeeId(id, userId)
    Repository->>Database: SELECT WHERE id AND employeeId
    Database-->>Repository: Row or empty
    alt Row exists
        Repository-->>TimeLogService: Optional[TimeLog]
        TimeLogService->>TimeLogService: Map → Response
        TimeLogService-->>TimeLogController: TimeLogResponse
    else Not found or unauthorized
        TimeLogService->>TimeLogService: Throw UnauthorizedAccessException
        TimeLogService-->>TimeLogController: Exception
    end
    TimeLogController-->>Client: 200/403/404 + JSON
Loading
sequenceDiagram
    participant App as Spring App
    participant DataSeeder
    participant Repository
    participant Database

    App->>DataSeeder: Bean initialization (CommandLineRunner)
    DataSeeder->>DataSeeder: Check if active profile == 'dev'
    alt Dev profile active
        DataSeeder->>Repository: findByEmployeeId(emp1)
        Repository->>Database: SELECT WHERE employeeId
        Database-->>Repository: Results
        alt No data exists
            DataSeeder->>DataSeeder: Generate 7 days of sample logs
            DataSeeder->>Repository: save(timeLog) ×30
            Repository->>Database: INSERT ×30
            Database-->>Repository: Confirm
            DataSeeder->>DataSeeder: Log "Seeded 30 records"
        else Data already exists
            DataSeeder->>DataSeeder: Skip seeding (idempotent)
        end
    else Non-dev profile
        DataSeeder->>DataSeeder: Exit without seeding
    end
    App->>App: Application ready on :8085
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

  • Multiple interconnected systems: Service layer has dense authorization/aggregation logic; controller has 9+ endpoints with varied scopes; exception handling spans multiple handlers.
  • Heterogeneous changes: DTOs and mappers are straightforward; controllers and services require intent verification; security config changes are significant; extensive documentation requires skimming for consistency.
  • Files requiring extra attention:
    • time-logging-service/src/main/java/.../service/TimeLogService.java — verify authorization checks (employee vs. admin access) and aggregation logic (summary/stats calculations)
    • time-logging-service/src/main/java/.../controller/TimeLogController.java — confirm @PreAuthorize role guards match endpoint intent and parameter extraction aligns with security context
    • time-logging-service/src/main/java/.../config/SecurityConfig.java — validate the security toggle behavior (dev vs. prod) and ensure whitelist correctness
    • time-logging-service/src/main/java/.../config/DataSeeder.java — confirm idempotence and that seeding logic produces expected UUIDs via SharedConstants
    • time-logging-service/src/main/java/.../exception/GlobalExceptionHandler.java — verify all exception cases map to correct HTTP status codes and response structure is consistent

Poem

🐰 Hops of joy through logs and time,
ServiceImpl stacks so very fine,
DTOs dance with RBAC grace,
Docker builds at quickened pace,
Eight-five port in Kubernetes space! 🚀

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cfe2c1c and 3552f41.

📒 Files selected for processing (52)
  • .github/workflows/build.yaml (1 hunks)
  • .github/workflows/deploy.yaml (1 hunks)
  • DATABASE_AND_RUNTIME_STATUS.md (1 hunks)
  • DATABASE_CONNECTION_SUMMARY.md (1 hunks)
  • DATABASE_SETUP_GUIDE.md (1 hunks)
  • Dockerfile (1 hunks)
  • IMPLEMENTATION_SUMMARY.md (1 hunks)
  • PROGRESS_REPORT.md (1 hunks)
  • QUICK_START.md (1 hunks)
  • README.md (1 hunks)
  • SUBMISSION_CHECKLIST.md (1 hunks)
  • time-logging-service/ALL_ISSUES_RESOLVED.md (1 hunks)
  • time-logging-service/BUILDER_ISSUE_FIXED.md (1 hunks)
  • time-logging-service/FIX_SUMMARY.md (1 hunks)
  • time-logging-service/GETTERS_FIXED.md (1 hunks)
  • time-logging-service/HOW_TO_RUN.md (1 hunks)
  • time-logging-service/PORT_CONFLICT_SOLUTION.md (1 hunks)
  • time-logging-service/QUICK_START.md (1 hunks)
  • time-logging-service/README.md (1 hunks)
  • time-logging-service/final-test.bat (1 hunks)
  • time-logging-service/pom.xml (1 hunks)
  • time-logging-service/scripts/smoke_test.bat (1 hunks)
  • time-logging-service/src/main/java/com/techtorque/time_logging_service/config/DataSeeder.java (1 hunks)
  • time-logging-service/src/main/java/com/techtorque/time_logging_service/config/DatabasePreflightInitializer.java (2 hunks)
  • time-logging-service/src/main/java/com/techtorque/time_logging_service/config/GatewayHeaderFilter.java (1 hunks)
  • time-logging-service/src/main/java/com/techtorque/time_logging_service/config/OpenApiConfig.java (1 hunks)
  • time-logging-service/src/main/java/com/techtorque/time_logging_service/config/SecurityConfig.java (3 hunks)
  • time-logging-service/src/main/java/com/techtorque/time_logging_service/config/SharedConstants.java (1 hunks)
  • time-logging-service/src/main/java/com/techtorque/time_logging_service/controller/TimeLogController.java (1 hunks)
  • time-logging-service/src/main/java/com/techtorque/time_logging_service/controller/TimeLoggingController.java (0 hunks)
  • time-logging-service/src/main/java/com/techtorque/time_logging_service/dto/mapper/TimeLogMapper.java (1 hunks)
  • time-logging-service/src/main/java/com/techtorque/time_logging_service/dto/request/TimeLogRequest.java (1 hunks)
  • time-logging-service/src/main/java/com/techtorque/time_logging_service/dto/request/TimeLogUpdateRequest.java (1 hunks)
  • time-logging-service/src/main/java/com/techtorque/time_logging_service/dto/response/TimeLogResponse.java (1 hunks)
  • time-logging-service/src/main/java/com/techtorque/time_logging_service/dto/response/TimeLogSummaryResponse.java (1 hunks)
  • time-logging-service/src/main/java/com/techtorque/time_logging_service/entity/TimeLog.java (2 hunks)
  • time-logging-service/src/main/java/com/techtorque/time_logging_service/error/RestExceptionHandler.java (1 hunks)
  • time-logging-service/src/main/java/com/techtorque/time_logging_service/events/NoopTimeLogEventPublisher.java (1 hunks)
  • time-logging-service/src/main/java/com/techtorque/time_logging_service/events/TimeLogEventPublisher.java (1 hunks)
  • time-logging-service/src/main/java/com/techtorque/time_logging_service/exception/GlobalExceptionHandler.java (1 hunks)
  • time-logging-service/src/main/java/com/techtorque/time_logging_service/exception/ResourceNotFoundException.java (1 hunks)
  • time-logging-service/src/main/java/com/techtorque/time_logging_service/exception/UnauthorizedAccessException.java (1 hunks)
  • time-logging-service/src/main/java/com/techtorque/time_logging_service/repository/TimeLogRepository.java (1 hunks)
  • time-logging-service/src/main/java/com/techtorque/time_logging_service/service/TimeLogService.java (1 hunks)
  • time-logging-service/src/main/java/com/techtorque/time_logging_service/service/TimeLoggingService.java (1 hunks)
  • time-logging-service/src/main/java/com/techtorque/time_logging_service/service/impl/TimeLoggingServiceImpl.java (2 hunks)
  • time-logging-service/src/main/resources/META-INF/spring.factories (1 hunks)
  • time-logging-service/src/main/resources/application.properties (1 hunks)
  • time-logging-service/src/test/java/com/techtorque/time_logging_service/TimeLoggingServiceApplicationTests.java (1 hunks)
  • time-logging-service/src/test/resources/application-test.properties (1 hunks)
  • time-logging-service/test-build.bat (1 hunks)
  • time-logging-service/test-endpoints.ps1 (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@RandithaK RandithaK merged commit a5b4278 into main Nov 8, 2025
10 of 12 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements the complete Time Logging Service for the TechTorque 2025 project, transitioning from stub implementations (24% complete) to a fully functional microservice (100% complete). The service enables employees to create, read, update, and delete time log entries, associate them with services/projects, and generate productivity summaries.

Key changes:

  • Implemented all 7 core REST API endpoints with proper business logic, security, and authorization
  • Added comprehensive exception handling with custom exceptions and global error handler
  • Created DTOs, mappers, and service layer implementations for time tracking operations
  • Configured database auto-setup with preflight checks and data seeding
  • Added OpenAPI/Swagger documentation and security configuration
  • Included extensive documentation files and test scripts

Reviewed Changes

Copilot reviewed 52 out of 53 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
TimeLogController.java Complete REST controller with 9 endpoints (7 core + 2 bonus)
TimeLogService.java Full service layer with business logic, authorization, and aggregation
TimeLoggingServiceImpl.java Alternative service implementation with similar functionality
GlobalExceptionHandler.java Comprehensive error handling with proper HTTP status codes
DataSeeder.java Database seeding with sample time logs for development
SharedConstants.java Cross-service data consistency constants
SecurityConfig.java JWT authentication and role-based access control
OpenApiConfig.java Swagger/OpenAPI documentation configuration
Various DTOs Request/response objects and mappers
Documentation files Extensive README, guides, and implementation summaries

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +35 to +36
public static final String EMPLOYEE_2 = "employee";
public static final String EMPLOYEE_3 = "employee";
Copy link

Copilot AI Nov 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The three employee constants have identical values ("employee"), which appears to be incorrect. Each employee should have a unique identifier. Based on the comment stating "Auth service only seeds one employee user", these should either be distinct employee IDs or only one constant should exist.

Suggested change
public static final String EMPLOYEE_2 = "employee";
public static final String EMPLOYEE_3 = "employee";

Copilot uses AI. Check for mistakes.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants